using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Input.Touch;
using Perovich.GameObjects.TwoDimensional;


namespace TwoDExampleProject
{



    /// <summary>
    /// Represents a simple 2-dimensional object in a game
    /// </summary>
    public class GameObject2 : BoundedObject2D
    {
        Perovich.GameObjects.Controls.Shapes.Line DebugLine;

        public bool ShowDebugLines
        {
            get;
            set;
        }

        public GameObject2(Perovich.GameObjects.Interfaces.ICanHoldComponents game)
            : base(game)
        {
            DebugLine = new Perovich.GameObjects.Controls.Shapes.Line(game);
            DebugLine.ForegroundColor = Color.Blue;
            DebugLine.Active = false;
            ShowDebugLines = true;
            base.SpriteBatchSet += new EventHandler<EventArgs>(GameObject2_SpriteBatchSet);
        }


        void GameObject2_SpriteBatchSet(object sender, EventArgs e)
        {
            DebugLine.SBatches = SBatches;
        }

        public override void Initialize()
        {
            base.Initialize();
            Bounds = new BoundingBox(new Vector3(0, 0, 0),
                                    new Vector3(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0));
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            DebugLine.Position = Position;
            DebugLine.Position2 = Position + Velocity;
            DebugLine.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (ShowDebugLines)
                DebugLine.Draw(gameTime);
        }


    }
}
